`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date: 2020/05/15 14:17:04
// Design Name: 
// Module Name: iic_cfg
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//////////////////////////////////////////////////////////////////////////////////


module iic_cfg(

input           clk,            //50m
input           rst_n,

inout           iic_sda,
inout           iic_scl
    );
    
//=============================
//phy
wire           [1:0]   cmd;
wire           [7:0]   wr_data;
wire           [15:0]  addr;
wire           [6:0]   device_addr;
wire                   done;
wire           [7:0]   rd_data;

i2c_phy#(
    .IIC_F100K(500),            //100K-500
    .IIC_F400K(125)            //400K-125
)
i2c_phy_inst(
    .clk_50m(clk),
    .rst_n(rst_n),
    .cmd(cmd),
    .wr_data(wr_data),
    .addr(addr),
    .device_addr(device_addr),
    .done(done),
    .rd_data(rd_data),
    .SDA(iic_sda),
    .SCL(iic_scl)                     //100K
);    
    
//==================================
//ctrl

i2c_ctrl    i2c_ctrl_inst(

    .clk_50m(clk),
    .rst_n(rst_n),
    
    .cmd(cmd),
    .wr_data(wr_data),
    .addr(addr),
    .device_addr(device_addr),
    
    .done(done),
    .rd_data(rd_data)
);    
    
    
    
    
    
endmodule
